package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"strings"
)

func _query(context *gin.Context) {
	user := context.Query("user")
	fmt.Println(user)

	//首字母大小写不区分 单词间用-连接
	auth := context.GetHeader("Auth")
	fmt.Println(auth)
	//首字母大小写区分    Header是普通map[string][]string
	auth1 := context.Request.Header.Get("Auth")
	auth2 := context.Request.Header["Auth"]
	fmt.Println(auth1, auth2)
	strings.Contains(auth, "test")

	context.JSON(200, gin.H{"msg": "成功"})
}

func main() {
	router := gin.Default()

	router.GET("/query", _query)

	router.Run(":8080")
}
